package com.lhnstart.learn.bases.date_;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;

/**
 * 第三代日期
 *
 * @author lhn
 * @date 2023/09/07 17:35
 * @since 1.0.0
 **/
public class LocalDate_ {

    public static void main(String[] args) {
        LocalDateTime localDateTime = LocalDateTime.now();
        System.out.println("localDateTime = " + localDateTime);

        // 使用 datetimeFormat
        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy年MM月dd日 HH时mm分ss秒");
        System.out.println("dtf = " + dtf.format(localDateTime));
        System.out.println("年" + localDateTime.getYear());
        System.out.println("月" + localDateTime.getMonth());
        System.out.println("月" + localDateTime.getMonthValue());
        System.out.println("日" + localDateTime.getDayOfMonth());
        System.out.println("时" + localDateTime.getHour());
        System.out.println("分" + localDateTime.getMinute());
        System.out.println("秒" + localDateTime.getSecond());

        LocalDate now = LocalDate.now();
        System.out.println("now = " + now);
        LocalTime now1 = LocalTime.now();
        System.out.println("now1 = " + now1);

    }

}